package gwc.domain

class MessageQueue {
	private def queue = [] as LinkedHashSet

	private static Long id = 0

	static def instance = new MessageQueue()
	
	def synchronized add(Message msg) {
		assert !msg.id
		msg.id = ++id
		queue << msg

		msg.id
	}

	def getFrom(msgId) {
		queue.findAll {it.id > msgId}
	}
}